<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>flex-direction</title>
    <style>
      .flex-container {
        display: -webkit-flex;
        display: flex;
        width: 400px;
        height: 150px;
        background-color: lightgrey;
      }

      .flex-item {
        background-color: cornflowerblue;
        width: 100px;
        height: 100px;
        line-height: 100px;
        margin: 10px;
        text-align: center;
      }
    </style>
  </head>

  <body>
    <h1>flex-direction 属性指定了弹性子元素在父容器中的位置</h1>

    <h2>flex-direction: row 横向从左到右排列（左对齐），默认的排列方式。</h2>
    <div class="flex-container" style="flex-direction: row">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      flex-direction: row-reverse
      反转横向排列（右对齐），从后往前排，最后一项排在最前面。
    </h2>
    <div class="flex-container" style="flex-direction: row-reverse">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>flex-direction: column 纵向排列。</h2>
    <div class="flex-container" style="flex-direction: column">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      flex-direction: column-reverse
      反转纵向排列，从后往前排，最后一项排在最上面。
    </h2>
    <div class="flex-container" style="flex-direction: column-reverse">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>
  </body>
</html>
